from django.contrib import admin

from oa.admin import SimpleModelAdmin, AutoUpdateUserModelAdmin
from .models import *


@admin.register(FlavorTag)
class FlavorTagAdmin(SimpleModelAdmin):
    list_display = ['pk', 'name', 'is_bad']
    list_display_links = ['pk', 'name']
    list_filter = ['is_bad']


@admin.register(RateRecord)
class RateRecordAdmin(AutoUpdateUserModelAdmin):
    list_display = [
        'pk', 'record_datetime', 'pack_batch',
        'aroma', 'flavor', 'appearance', 'feeling', 'overall', 'notes'
    ]
    list_display_links = ['pk', 'record_datetime']
    list_filter = ['pack_batch', 'product_batch', 'product_package', 'product_name']
    autocomplete_fields = ['pack_batch', 'product_batch', 'product_package', 'product_name']
    filter_horizontal = ['flavor_tags']
